Drupal
code snippets (expand me!)
Bash.sh
CSS.css
JavaScript.js
PHP.php
Python.py
Ruby.rb
Scheme.scm
SQL.sql
XML.xml
函数
文件
binary files are OK too.jpg
index.md
Sample HTML document.html
Sample Markdown document.md
/wiki
code snippets (expand me!)
Ruby.rb
# I snatched this class from the GitLab repository (https://github.com/gitlabhq/gitlabhq/tree/master/app/observers) class ActivityObserver < ActiveRecord::Observer observe :issue, :merge_request, :note, :milestone def after_create(record) event_author_id = record.author_id # Skip status notes if record.kind_of?(Note) && record.note.include?("_Status changed to ") return true end if event_author_id Event.create( project: record.project, target_id: record.id, target_type: record.class.name, action: Event.determine_action(record), author_id: event_author_id ) end end def after_close(record, transition) Event.create( project: record.project, target_id: record.id, target_type: record.class.name, action: Event::CLOSED, author_id: record.author_id_of_changes ) end def after_reopen(record, transition) Event.create( project: record.project, target_id: record.id, target_type: record.class.name, action: Event::REOPENED, author_id: record.author_id_of_changes ) end end